home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sgverinf / FRMTEST.FRM < prev    next >
Text File  |  1998-06-04  |  5KB  |  161 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  4. Begin VB.Form frmTest 
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "Test SG Version Info"
  7.    ClientHeight    =   6315
  8.    ClientLeft      =   2205
  9.    ClientTop       =   2385
  10.    ClientWidth     =   8625
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6315
  15.    ScaleWidth      =   8625
  16.    ShowInTaskbar   =   0   'False
  17.    Begin MSComDlg.CommonDialog cmnDlg 
  18.       Left            =   5760
  19.       Top             =   1800
  20.       _ExtentX        =   847
  21.       _ExtentY        =   847
  22.       _Version        =   327681
  23.    End
  24.    Begin VB.Frame Frame1 
  25.       Caption         =   "Version Info"
  26.       Height          =   5415
  27.       Left            =   135
  28.       TabIndex        =   3
  29.       Top             =   720
  30.       Width           =   8340
  31.       Begin ComctlLib.ListView lvwVerInfo 
  32.          Height          =   4920
  33.          Left            =   135
  34.          TabIndex        =   4
  35.          Top             =   360
  36.          Width           =   8025
  37.          _ExtentX        =   14155
  38.          _ExtentY        =   8678
  39.          View            =   3
  40.          LabelEdit       =   1
  41.          LabelWrap       =   -1  'True
  42.          HideSelection   =   -1  'True
  43.          _Version        =   327682
  44.          ForeColor       =   -2147483640
  45.          BackColor       =   -2147483643
  46.          BorderStyle     =   1
  47.          Appearance      =   1
  48.          NumItems        =   2
  49.          BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  50.             Key             =   ""
  51.             Object.Tag             =   ""
  52.             Text            =   "Value Name"
  53.             Object.Width           =   2540
  54.          EndProperty
  55.          BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
  56.             SubItemIndex    =   1
  57.             Key             =   ""
  58.             Object.Tag             =   ""
  59.             Text            =   "Value"
  60.             Object.Width           =   7937
  61.          EndProperty
  62.       End
  63.    End
  64.    Begin VB.CommandButton cmdBrowse 
  65.       Caption         =   "&Browse..."
  66.       Height          =   375
  67.       Left            =   7155
  68.       TabIndex        =   2
  69.       Top             =   225
  70.       Width           =   1275
  71.    End
  72.    Begin VB.TextBox txtFile 
  73.       Height          =   375
  74.       Left            =   675
  75.       TabIndex        =   0
  76.       Top             =   225
  77.       Width           =   6270
  78.    End
  79.    Begin VB.Label Label1 
  80.       Caption         =   "File:"
  81.       Height          =   330
  82.       Left            =   180
  83.       TabIndex        =   1
  84.       Top             =   270
  85.       Width           =   555
  86.    End
  87. End
  88. Attribute VB_Name = "frmTest"
  89. Attribute VB_GlobalNameSpace = False
  90. Attribute VB_Creatable = False
  91. Attribute VB_PredeclaredId = True
  92. Attribute VB_Exposed = False
  93. Option Explicit
  94.  
  95. Dim VerInfo As VersionInfo
  96.  
  97. Private Sub InsertItem(name$, value$)
  98.     Dim item As ListItem
  99.     
  100.     Set item = lvwVerInfo.ListItems.Add(, , name)
  101.     item.SubItems(1) = value
  102.         
  103. End Sub
  104.  
  105. Private Sub ShowVerInfo()
  106.     On Error GoTo Error_
  107.     
  108.     lvwVerInfo.ListItems.Clear
  109.     Frame1.Caption = "Version Info (" + txtFile.Text + ")"
  110.     VerInfo.Path = txtFile.Text
  111.     
  112.     If VerInfo.InfoExist Then
  113.         InsertItem "FileDescription", VerInfo.FileDescription
  114.         InsertItem "ProductName", VerInfo.ProductName
  115.         InsertItem "FileVersion", VerInfo.FileVersion
  116.         InsertItem "ProductVersion", VerInfo.ProductVersion
  117.         InsertItem "CompanyName", VerInfo.CompanyName
  118.         InsertItem "InternalName", VerInfo.InternalName
  119.         InsertItem "OriginalFilename", VerInfo.OriginalFilename
  120.         InsertItem "PrivateBuild", VerInfo.PrivateBuild
  121.         InsertItem "SpecialBuild", VerInfo.SpecialBuild
  122.         InsertItem "LegalCopyright", VerInfo.LegalCopyright
  123.         InsertItem "LegalTrademarks", VerInfo.GetValue("StringFileInfo", "LegalTrademarks")
  124.         InsertItem "Language", VerInfo.LanguageName
  125.         InsertItem "Comments", VerInfo.Comments
  126.         InsertItem "OS", VerInfo.FileOSString
  127.     Else
  128.         InsertItem GetFilename(txtFile.Text), "File does not contain version info resource"
  129.     End If
  130.     
  131.     Exit Sub
  132. Error_:
  133.     MsgBox Error$
  134. End Sub
  135.  
  136.  
  137. Private Sub cmdBrowse_Click()
  138.     On Error GoTo Error_
  139.     
  140.     cmnDlg.Filter = "Win32 Modules (*.exe,*.dll,*.fon,*.ttf)|*.exe;*.dll;*.fon;*.ttf|All Files (*.*)|*.*||"
  141.     cmnDlg.ShowOpen
  142.     If (cmnDlg.filename <> "") Then
  143.         txtFile = cmnDlg.filename
  144.         ShowVerInfo
  145.     End If
  146.     
  147.     Exit Sub
  148. Error_:
  149.     MsgBox Error$
  150. End Sub
  151.  
  152. Private Sub Form_Load()
  153.     Set VerInfo = New VersionInfo
  154. End Sub
  155.  
  156. Private Sub txtFile_KeyDown(KeyCode As Integer, Shift As Integer)
  157.     If (KeyCode = vbKeyReturn) Then
  158.         ShowVerInfo
  159.     End If
  160. End Sub
  161.